﻿create PROCEDURE Sync.SP_CommitteeBankAccountExpenses_SelectChanges
@LastRowVersion rowversion,
@FilterdColumn UNIQUEIDENTIFIER
AS 
BEGIN 
	SELECT 
        t.[CommitteeBankAccountExpensesID],
		g.[CommitteeBankAccountID],g.[WithdrawDate],g.[WithdrawAmount],g.[WithdrawCheckNumber],g.[Notes],
		t.IsDeleted,
		t.LastUpdatedDate
	FROM [dbo].[CommitteeBankAccountExpenses] g RIGHT JOIN Sync.CommitteeBankAccountExpenses_Tracking t  
    ON t.CommitteeBankAccountExpensesID = g.CommitteeBankAccountExpensesID 
    join CommitteeBankAccount on CommitteeBankAccount.CommitteeBankAccountID = g.CommitteeBankAccountID
	WHERE (@LastRowVersion IS NULL OR t.Version > @LastRowVersion)
	AND ((@FilterdColumn IS NULL) OR (CommitteeBankAccount.CommitteeID = @FilterdColumn))
    END











